' This script demonstrates how to stroke and fill the current selection.
' This scripts draws a black stroke around the selection and then
' fills it with red.

Private Sub Command1_Click()

Dim appRef As New Photoshop.Application
Dim docRef As Photoshop.Document
Dim selRef As Photoshop.Selection
Dim strokeColor As Photoshop.SolidColor
Dim fillColor As Photoshop.SolidColor

appRef.DisplayDialogs = psDisplayNoDialogs
appRef.Preferences.RulerUnits = psInches

If (appRef.Documents.Count > 0) Then
    
    Set docRef = appRef.ActiveDocument
    Set selRef = docRef.Selection

    docRef.ActiveLayer = docRef.Layers(1)
    
    ' Create the solid color and fill it with a CMYK color
    Set strokeColor = CreateObject("Photoshop.SolidColor")
    
    With strokeColor
        .CMYK.Cyan = 0
        .CMYK.Magenta = 0
        .CMYK.Yellow = 0
        .CMYK.Black = 100
    End With
    
    selRef.Stroke strokeColor, Width:=10
    
    ' Create the solid color and fill it with an RGB color
    Set fillColor = CreateObject("Photoshop.SolidColor")
    
    With fillColor
        .RGB.Red = 255
        .RGB.Green = 0
        .RGB.Blue = 0
    End With
    
    selRef.Fill fillColor
    
Else
    MsgBox ("There must be at least one open document to run this script!")
End If

End Sub
